// sellergoods.js
var app = getApp();
Page({
  data:{
    index:0
  },
  //商家商品接口
list2: function (sort, id, that){
    var url = app.data.url
    wx.request({
      url: '' + url + '/shop/goods/getlist3',
      data: { sort: sort, membersellerid:id },
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
        console.log(res.data)
        that.setData({
          list2: res.data.Rows
        })
      },
      error: function (res) {
        console.log(res)
      }
    })
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
     var id=options.id;
     var that=this;
     var url = app.data.url;
     wx.request({
       //头部信息接口
       url: '' + url + '/shop/index/GetLogo',
       data: {id:id},
       header: {
         'Content-Type': 'application/json'
       },
       success: function (res) {
         console.log(res.data+'1111')
         that.setData({
           list: res.data.Rows
         })
       },
       error: function (res) {
         console.log(res)
       }
     });
     that.setData({
       id:id
     })
     that.list2(1, id, that)
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  },
  /*
   * 点击切换筛选条件
   */
  changeActive2: function (e) {
    var id = this.data.id;
    this.list2(e.currentTarget.dataset.sort, id, this)
    var index = e.currentTarget.dataset.index;
    this.setData({
      index: index
    })
  },
  changeActive: function(e){
    var id=this.data.id;
    this.list2(e.currentTarget.dataset.sort,id, this)
    let index = e.currentTarget.dataset.index;
    this.setData({
      index: index
    })
  }
})